﻿<%@ Page Title="" Language="VB" MasterPageFile="~/manage/MasterPage.master" AutoEventWireup="false" CodeFile="company.aspx.vb" Inherits="manage_company" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder2" Runat="Server">
    <p>
    <asp:GridView ID="GridView1" runat="server" AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False" DataKeyNames="company" DataSourceID="SqlDataSource1">
        <Columns>
            <asp:BoundField DataField="company" HeaderText="company" ReadOnly="True" SortExpression="company" />
            <asp:BoundField DataField="Address" HeaderText="Address" SortExpression="Address" />
            <asp:BoundField DataField="Email" HeaderText="Email" SortExpression="Email" />
            <asp:BoundField DataField="ContactPerson" HeaderText="ContactPerson" SortExpression="ContactPerson" />
            <asp:BoundField DataField="Work" HeaderText="Work" SortExpression="Work" />
            <asp:BoundField DataField="Mobile" HeaderText="Mobile" SortExpression="Mobile" />
            <asp:BoundField DataField="Comments" HeaderText="Comments" SortExpression="Comments" Visible="False" />
            <asp:BoundField DataField="AssignedAgent" HeaderText="AssignedAgent" SortExpression="AssignedAgent" />
        </Columns>
    </asp:GridView>
        <asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True" DataSourceID="SqlDataUsers" DataTextField="UserName" DataValueField="LoweredUserName">
        </asp:DropDownList>
    <br />
        <asp:FormView ID="FormView1" runat="server" AllowPaging="True" BackColor="White" BorderColor="#CCCCCC" BorderStyle="None" BorderWidth="1px" CellPadding="4" DataKeyNames="company" DataSourceID="SqlDataSource1" ForeColor="Black" GridLines="Horizontal">
            <EditItemTemplate>
                <table style="width:100%;">
                    <tr>
                        <td style="width: 80px; ">company: </td>
                        <td>
                            <asp:Label ID="companyLabel1" runat="server" Text='<%# Eval("company") %>' />
                        </td>
                    </tr>
                    <tr>
                        <td style="width: 80px; ">Address: </td>
                        <td>
                            <asp:TextBox ID="AddressTextBox" runat="server" Text='<%# Bind("Address") %>' />
                        </td>
                    </tr>
                    <tr>
                        <td style="width: 80px; ">Email: </td>
                        <td>
                            <asp:TextBox ID="EmailTextBox" runat="server" Text='<%# Bind("Email") %>' />
                        </td>
                    </tr>
                    <tr>
                        <td style="width: 80px; ">ContactPerson:</td>
                        <td>
                            <asp:TextBox ID="ContactPersonTextBox" runat="server" Text='<%# Bind("ContactPerson") %>' />
                        </td>
                    </tr>
                    <tr>
                        <td style="width: 80px; ">Work: </td>
                        <td>
                            <asp:TextBox ID="WorkTextBox" runat="server" Text='<%# Bind("Work") %>' />
                        </td>
                    </tr>
                    <tr>
                        <td style="width: 80px; ">Mobile: </td>
                        <td>
                            <asp:TextBox ID="MobileTextBox" runat="server" Text='<%# Bind("Mobile") %>' />
                        </td>
                    </tr>
                    <tr>
                        <td style="width: 80px; ">Comments:</td>
                        <td>
                            <asp:TextBox ID="CommentsTextBox" runat="server" Text='<%# Bind("Comments") %>' />
                        </td>
                    </tr>
                    <tr>
                        <td style="width: 80px; ">AssignedAgent: </td>
                        <td>
                            <asp:TextBox ID="AssignedAgentTextBox" runat="server" Text='<%# bind("AssignedAgent") %>'></asp:TextBox>
                        </td>
                    </tr>
                </table>
                <br />
                <table style="width:100%;">
                    <tr>
                        <td>
                            <asp:LinkButton ID="UpdateButton" runat="server" CausesValidation="True" CommandName="Update" Text="Update" />
                        </td>
                        <td>
                            <asp:LinkButton ID="UpdateCancelButton" runat="server" CausesValidation="False" CommandName="Cancel" Text="Cancel" />
                        </td>
                    </tr>
                </table>
            </EditItemTemplate>
            <EditRowStyle BackColor="#CC3333" Font-Bold="True" ForeColor="White" />
            <FooterStyle BackColor="#CCCC99" ForeColor="Black" />
            <HeaderStyle BackColor="#333333" Font-Bold="True" ForeColor="White" />
            <InsertItemTemplate>
                company:
                <asp:TextBox ID="companyTextBox" runat="server" Text='<%# Bind("company") %>' />
                <br />
                Address:
                <asp:TextBox ID="AddressTextBox" runat="server" Text='<%# Bind("Address") %>' />
                <br />
                Email:
                <asp:TextBox ID="EmailTextBox" runat="server" Text='<%# Bind("Email") %>' />
                <br />
                ContactPerson:
                <asp:TextBox ID="ContactPersonTextBox" runat="server" Text='<%# Bind("ContactPerson") %>' />
                <br />
                Work:
                <asp:TextBox ID="WorkTextBox" runat="server" Text='<%# Bind("Work") %>' />
                <br />
                Mobile:
                <asp:TextBox ID="MobileTextBox" runat="server" Text='<%# Bind("Mobile") %>' />
                <br />
                Comments:
                <asp:TextBox ID="CommentsTextBox" runat="server" Text='<%# Bind("Comments") %>' />
                <br />
                AssignedAgent:
                <asp:DropDownList ID="AssignedAgentTextBox" runat="server">
                </asp:DropDownList>
                <br />
                <asp:LinkButton ID="InsertButton" runat="server" CausesValidation="True" CommandName="Insert" Text="Insert" />
                &nbsp;<asp:LinkButton ID="InsertCancelButton" runat="server" CausesValidation="False" CommandName="Cancel" Text="Cancel" />
            </InsertItemTemplate>
            <ItemTemplate>
                &nbsp;<table style="width:100%;">
                    <tr>
                        <td style="width: 90px; text-align: right;">company: </td>
                        <td>
                            <asp:Label ID="companyLabel" runat="server" Text='<%# Eval("company") %>' />
                        </td>
                    </tr>
                    <tr>
                        <td style="width: 90px; text-align: right;">Address: </td>
                        <td>
                            <asp:Label ID="AddressLabel" runat="server" Text='<%# Bind("Address") %>' />
                        </td>
                    </tr>
                    <tr>
                        <td style="width: 90px; text-align: right;">Email: </td>
                        <td>
                            <asp:Label ID="EmailLabel" runat="server" Text='<%# Bind("Email") %>' />
                        </td>
                    </tr>
                    <tr>
                        <td style="width: 90px; text-align: right;">ContactPerson: </td>
                        <td>
                            <asp:Label ID="ContactPersonLabel" runat="server" Text='<%# Bind("ContactPerson") %>' />
                        </td>
                    </tr>
                    <tr>
                        <td style="width: 90px; text-align: right;">Work: </td>
                        <td>
                            <asp:Label ID="WorkLabel" runat="server" Text='<%# Bind("Work") %>' />
                        </td>
                    </tr>
                    <tr>
                        <td style="width: 90px; text-align: right;">Mobile: </td>
                        <td>
                            <asp:Label ID="MobileLabel" runat="server" Text='<%# Bind("Mobile") %>' />
                        </td>
                    </tr>
                    <tr>
                        <td style="width: 90px; text-align: right;">Comments: </td>
                        <td>
                            <asp:Label ID="CommentsLabel" runat="server" Text='<%# Bind("Comments") %>' />
                        </td>
                    </tr>
                    <tr>
                        <td style="width: 90px; text-align: right;">AssignedAgent: </td>
                        <td>
                            <asp:Label ID="AssignedAgentLabel" runat="server" Text='<%# Bind("AssignedAgent") %>' />
                        </td>
                    </tr>
                    <tr>
                        <td style="width: 90px; text-align: right;">&nbsp;</td>
                        <td>&nbsp;</td>
                    </tr>
                </table>
                <table style="width:100%;">
                    <tr>
                        <td>
                            <asp:LinkButton ID="EditButton" runat="server" CausesValidation="False" CommandName="Edit" Text="Edit" />
                        </td>
                        <td>
                            <asp:LinkButton ID="DeleteButton" runat="server" CausesValidation="False" CommandName="Delete" Text="Delete" />
                        </td>
                        <td>
                            <asp:LinkButton ID="NewButton" runat="server" CausesValidation="False" CommandName="New" Text="New" />
                        </td>
                    </tr>
                </table>
                <br />
                &nbsp;&nbsp;
            </ItemTemplate>
            <PagerStyle BackColor="White" ForeColor="Black" HorizontalAlign="Right" />
        </asp:FormView>
</p>
<p>
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="Data Source=(LocalDB)\v11.0;AttachDbFilename=|DataDirectory|\ASPNETDB.MDF;Integrated Security=True" DeleteCommand="DELETE FROM [inv_company] WHERE [company] = @company" InsertCommand="INSERT INTO [inv_company] ([company], [Address], [Email], [ContactPerson], [Work], [Mobile], [Comments], [AssignedAgent]) VALUES (@company, @Address, @Email, @ContactPerson, @Work, @Mobile, @Comments, @AssignedAgent)" ProviderName="System.Data.SqlClient" SelectCommand="SELECT * FROM [inv_company]" UpdateCommand="UPDATE [inv_company] SET [Address] = @Address, [Email] = @Email, [ContactPerson] = @ContactPerson, [Work] = @Work, [Mobile] = @Mobile, [Comments] = @Comments, [AssignedAgent] = @AssignedAgent WHERE [company] = @company">
        <DeleteParameters>
            <asp:Parameter Name="company" Type="String" />
        </DeleteParameters>
        <InsertParameters>
            <asp:Parameter Name="company" Type="String" />
            <asp:Parameter Name="Address" Type="String" />
            <asp:Parameter Name="Email" Type="String" />
            <asp:Parameter Name="ContactPerson" Type="String" />
            <asp:Parameter Name="Work" Type="String" />
            <asp:Parameter Name="Mobile" Type="String" />
            <asp:Parameter Name="Comments" Type="String" />
            <asp:Parameter Name="AssignedAgent" Type="String" />
        </InsertParameters>
        <UpdateParameters>
            <asp:Parameter Name="Address" Type="String" />
            <asp:Parameter Name="Email" Type="String" />
            <asp:Parameter Name="ContactPerson" Type="String" />
            <asp:Parameter Name="Work" Type="String" />
            <asp:Parameter Name="Mobile" Type="String" />
            <asp:Parameter Name="Comments" Type="String" />
            <asp:Parameter Name="AssignedAgent" Type="String" />
            <asp:Parameter Name="company" Type="String" />
        </UpdateParameters>
    </asp:SqlDataSource>
    <asp:SqlDataSource ID="SqlDataUsers" runat="server" ConnectionString="Data Source=(LocalDB)\v11.0;AttachDbFilename=|DataDirectory|\ASPNETDB.MDF;Integrated Security=True" ProviderName="System.Data.SqlClient" SelectCommand="SELECT * FROM [vw_aspnet_Users]"></asp:SqlDataSource>
</p>
</asp:Content>

